package com.hxy.springcloud.service;

import com.hxy.springcloud.pojo.Department;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

//给接口添加feign注解，标注服务名称
//value 设置服务名称
//fallbackFactory 设置服务降级
@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPARTMENT", fallbackFactory = DeptClientServiceFallbackFactory.class)
public interface DeptClientService {

    @PostMapping("/dept/add")
    boolean addDepartment(Department department);

    @GetMapping("/dept/queryById/{id}")
    Department queryById(@PathVariable("id") long id);

    @GetMapping("/dept/queryAll")
    List<Department> queryAllDepartment();
}
